package cn.kzgg.ymcc.feign;

import cn.kzgg.ymcc.doc.CourseDoc;
import cn.kzgg.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseSearchFeignClientFallbackFactory implements FallbackFactory<CourseSearchFeignClient> {
    @Override
    public CourseSearchFeignClient create(Throwable throwable) {
        return new CourseSearchFeignClient() {
            @Override
            public JSONResult saveCourse(CourseDoc courseDoc) {
                throwable.printStackTrace();
                return JSONResult.error("Es搜索服务不可达");
            }

            @Override
            public JSONResult remCourse(Long courseId) {
                return JSONResult.error("Es搜索服务不可达2") ;
            }
        };
    }
}
